﻿using Brouteforce.NewManagers;
using Brouteforce.OldStuff.oldGameObjs;
using Brouteforce.utilities;
using Microsoft.Xna.Framework;

namespace Brouteforce.OldStuff.uiOld {

    public class CheckBox : ISelectableGameObject {
        private Sprite sprite;
        private bool Checked;

        public CheckBox(Sprite sprite){
            this.sprite = sprite;
        }

        public void Update(){
            if (InputManager.Instance.IsMouseClickedOn(sprite.Location.Position)){
                Checked = !Checked;
            }
        }

        public void Draw(int cameraX, int cameraY){
            sprite.Draw(cameraX, cameraX);
            if (Checked){
                Draws.DrawBorder(sprite.Location.GetPositionRelativeToCamera(cameraX, cameraY), Color.Yellow, 1);
            }else{
                Draws.DrawBorder(sprite.Location.GetPositionRelativeToCamera(cameraX, cameraY), Color.Gray, 1);
            }
        }

        public bool Selected{
            get { return Checked; }
            set { Checked = value; }
        }
    }
}
